#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <stack>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
char c[100];
int get_p()
{
	cin>>c;
	if(strcmp(c,"-F")==0) return 8;
	if(strcmp(c,"-Cl")==0) return 7;
	if(strcmp(c,"-Br")==0) return 6;
	if(strcmp(c,"-I")==0) return 5;
	if(strcmp(c,"-CH3")==0) return 4;
	if(strcmp(c,"-CH2CH3")==0) return 3;
	if(strcmp(c,"-CH2CH2CH3")==0) return 2;
	if(strcmp(c,"-H")==0) return 1;
}
void solve()
{
	int p[5];
	int a[10]={0};
	for(int i=1;i<=4;i++)
	{
		p[i]=get_p();
//		cout<<p[i]<<endl;
		a[p[i]]++;
	}
	if(p[1]==p[3] || p[2]==p[4])
	{
		cout<<"None";
		return ;
	}
	int f=0;
	for(int i=1;i<=8;i++)
	{
		if(a[i]>=2) f=1;
    }
    if(f)
    {
    	if(p[1]==p[2] || p[3]==p[4])
    	{
    		cout<<"Cis";
    		return;
		}
		else
		{
			cout<<"Trans";
			return ;
		}
	}
	else
	{
		if(p[1]<p[3] && p[2]<p[4])
		{
			cout<<"Zasamman";
		}
		else if(p[1]>p[3] && p[2]>p[4])
		{
			cout<<"Zasamman";
		}
		else
		{
			cout<<"Entgegen";
		}
	}
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
		if(T!=0) cout<<endl;
	}

	return 0;
}

